<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    okText="通过"
    cancelText="拒绝"
    @ok="handleOk"
    @cancel="handleCancel"
    :footer="customFooter"
  >
    <a-descriptions bordered>
            <a-descriptions-item label="本人照片" :span="1">
       <img :src="obj.expertPhoto"  style="width: 50px;height: 50px" alt="">
      </a-descriptions-item>
      <a-descriptions-item label="姓名" :span="2">
        {{ obj.expertName }}
      </a-descriptions-item>
      <a-descriptions-item label="手机号">
        {{ obj.expertPhone }}
      </a-descriptions-item>
      <a-descriptions-item label="照片(可点击查看)" :span="3">
        <img
          :src="item"
          mode="scaleToFill"
          style="width: 50px;height: 50px;margin-left: 10px;"
          @click="ImgClick(item)"
          v-for="(item,index) in obj.pictureList"
          :key="index"
        />
      </a-descriptions-item>
    </a-descriptions>
  </j-modal>
</template>

<script>
import { auditById, auditDispose } from "@/api/tsapi";
export default {
  name: "detailModal",
  data() {
    return {
      visible: false,
      title: "入驻专家审核详情",
      obj: {},
    };
  },
  methods: {
    //入驻专家审核详情
    detail(record) {
      this.visible = true;
      let params = {
        expertId: record.expertId,
      };
      auditById(params).then((res) => {
        this.obj = res.result;
      });
    },
    handleOk() {
      const params = {
        auditStatus: 4,
        expertId: this.obj.expertId,
      };
      this.Stop(params);
      this.visible = false;
    },
    handleCancel() {
      this.visible = false;
    },
    Cancel() {
      const params = {
        auditStatus: 3,
        expertId: this.obj.expertId,
      };
      this.Stop(params);
      this.visible = false;
    },
    //自定义底部按钮
    customFooter() {
      return (
        <span class="custom-button">
          <a-button onClick={this.handleCancel}>取消</a-button>
          <a-button type="primary" onClick={this.Cancel}>
            拒绝
          </a-button>
          <a-button type="primary" onClick={this.handleOk}>
            通过
          </a-button>
        </span>
      );
    },
    //拒绝或者通过接口
    Stop(params) {
      auditDispose(params).then((res) => {
        if (res.code == 200) {
          this.$message.success(res.message);
          this.$emit("ok");
        } else {
          this.$message.error(res.message);
        }
      });
    },
    //打开图片
    ImgClick(imgurl) {
      window.open(
        imgurl
      );
    },
  },
};
</script>

<style lang="scss" scoped></style>
